/**
 * 统一发送消息方法。
 * 发送格式统一.
 * @author aker
 * @date 2019/7/31
 */

import{ IResponse } from '../Interfaces/IResponse'
export default function (success=true, code?:number, msg?:string, appendRest?:any): IResponse {
  if (success === true) {
    code = code || 200
    msg = msg || "成功"
  } else {
    code = code || 400
    msg = msg || "失败"
  }
  return {
    success,
    status: {
      code,
      msg
    },
    ...appendRest
  }
}
